@{ Media startMedia = new Media(1340); foreach(Media m in startMedia.GetChildMedia()) { string umbracoImageFileName = @m.getProperty("umbracoFile").Value.ToString(); string umbracoImageExtension = @m.getProperty("umbracoExtension").Value.ToString(); string imageUrl = CropUp.GetUrl(umbracoImageFileName, new ImageSizeArguments() { CropAlias = "CoverPage" }); <img src="@imageUrl" /> } }
When I save, I got an error "CS1513: Expected }". Seems that the error comes from the row where I define the ImageUrl. Another question, as you can see I get the Media object by Id; can I do by name? in my case carouselImages?
What version of Umbraco are you using and, Which type offilerazor did you use for this. Here I am think if you´re using Partial View, or Partial View Maco file. Becausethe only way Ican reproducethe sameerrorasyouareusing the old legacy Dynamic Node Razor file, (The files that are located under the scripting folder in the developer section) and the dynamic node razor is deprecated.
If I try to paste the same piece into a parital view or a partial view macro I can save it without any errors.
The code that you have posted above is strongly typed razor, and for this you need to use a parital view or a partial view macro.
CS1513: Expected } ...but where?
Hi, I'm tring to cycle the images inside a mediafolder called "coverImages". This is my razor code:
When I save, I got an error "CS1513: Expected }". Seems that the error comes from the row where I define the ImageUrl. Another question, as you can see I get the Media object by Id; can I do by name? in my case carouselImages?
Hi Barbacan,
What version of Umbraco are you using and, Which type of file razor did you use for this. Here I am think if you´re using Partial View, or Partial View Maco file. Because the only way I can reproduce the same error as you are using the old legacy Dynamic Node Razor file, (The files that are located under the scripting folder in the developer section) and the dynamic node razor is deprecated.
If I try to paste the same piece into a parital view or a partial view macro I can save it without any errors.
The code that you have posted above is strongly typed razor, and for this you need to use a parital view or a partial view macro.
You can find cheatsheets for Dynamic razor and strongly typed razor here: http://our.umbraco.org/projects/developer-tools/umbraco-v6-mvc-razor-cheatsheets
Hope this helps,
/Dennis
is working on a reply...